/**
  * Author: Mei
  * Date: 2020-11-21 16:01
  * Description: 
  *
  */
#include <iostream>
#include <cstring>

using namespace std;

template<typename T>
void fun(T a) {
    cout << "The main template fun(): " << a << endl;
}

template<>
// 对int型特例化
void fun(int a) {
    cout << "Specialized template for int type: " << a << endl;
}

template <typename T, typename R>
class Test{
public:
    void print(){
        cout << "General template object" << endl;
    }
};

template<typename T>   // 对int型特例化
class Test<int,T>{
public:
    void print(){
        cout << "Specialized template object" << endl;
    }
};

int main()
{
    Test<int, float > a;
    Test<char, char> b;
    Test<int, int> c;
    a.print();
    b.print();
    c.print();
    return 0;
}
//int main() {
//    fun<char>('a');
//    fun<int>(10);
//    fun<float>(9.15);
//    return 0;
//}